IMPORTING MODULES

In [1]:
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from matplotlib import gridspec
import matplotlib.patheffects as path_effects
import plotly.express as px
import plotly.graph_objects as go
from plotly.offline import init_notebook_mode, iplot
import plotly.figure_factory as ff
from textblob import TextBlob
import altair as alt
from collections import Counter
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.pairwise import linear_kernel
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.metrics.pairwise import cosine_similarity
In [2]:
netflix_tiles= pd.read_csv("C:\\Users\\Prashant\\Desktop\\Case Studies\\Python\\Netflix\\netflix.csv")
In [3]:
netflix=netflix_tiles.fillna(0)
In [4]:
netflix.describe()
Out[4]:
show_id release_year
count 6.049000e+03 6049.000000
mean 7.708834e+07 2013.532815
std 1.004384e+07 8.677437
min 2.477470e+05 1925.000000
25% 8.004218e+07 2013.000000
50% 8.016530e+07 2016.000000
75% 8.024493e+07 2018.000000
max 8.123560e+07 2019.000000

CONTENT ANALYSIS

Shows vs Movies Count

In [5]:
counts = netflix["type"].value_counts()
fig= px.bar(counts,title='Count of Shows and Movies on Netflix', 
                  color_discrete_sequence=px.colors.cyclical.HSV,template='plotly_dark')
fig.show()

Shows vs Movies Percentage

In [6]:
fig= px.pie(counts, values='type',title='Distribution of Show Ratings on Netflix',
                  color_discrete_sequence=px.colors.sequential.Reds_r,template='plotly_dark')
fig.show()

Shows

In [7]:
netflix_shows=netflix[netflix['type']=='TV Show']
netflix_shows
Out[7]:
show_id type title director cast country date_added release_year rating duration listed_in description
2 70234439 TV Show Transformers Prime 0 Peter Cullen, Sumalee Montano, Frank Welker, J... United States September 8, 2018 2013 TV-Y7-FV 1 Season Kids' TV With the help of three human allies, the Autob...
3 80058654 TV Show Transformers: Robots in Disguise 0 Will Friedle, Darren Criss, Constance Zimmer, ... United States September 8, 2018 2016 TV-Y7 1 Season Kids' TV When a prison ship crash unleashes hundreds of...
5 80163890 TV Show Apaches 0 Alberto Ammann, Eloy Azorín, Verónica Echegui,... Spain September 8, 2017 2016 TV-MA 1 Season Crime TV Shows, International TV Shows, Spanis... A young journalist is forced into a life of cr...
8 80117902 TV Show Fire Chasers 0 0 United States September 8, 2017 2017 TV-MA 1 Season Docuseries, Science & Nature TV As California's 2016 fire season rages, brave ...
26 80244601 TV Show Castle of Stars 0 Chaiyapol Pupart, Jintanutda Lummakanon, Worra... 0 September 7, 2018 2015 TV-14 1 Season International TV Shows, Romantic TV Shows, TV ... As four couples with different lifestyles go t...
... ... ... ... ... ... ... ... ... ... ... ... ...
6043 80159925 TV Show Kikoriki 0 Igor Dmitriev 0 0 2010 TV-Y 2 Seasons Kids' TV A wacky rabbit and his gang of animal pals hav...
6044 80000063 TV Show Red vs. Blue 0 Burnie Burns, Jason Saldaña, Gustavo Sorola, G... United States 0 2015 NR 13 Seasons TV Action & Adventure, TV Comedies, TV Sci-Fi ... This parody of first-person shooter games, mil...
6045 70286564 TV Show Maron 0 Marc Maron, Judd Hirsch, Josh Brener, Nora Zeh... United States 0 2016 TV-MA 4 Seasons TV Comedies Marc Maron stars as Marc Maron, who interviews...
6047 70281022 TV Show A Young Doctor's Notebook and Other Stories 0 Daniel Radcliffe, Jon Hamm, Adam Godley, Chris... United Kingdom 0 2013 TV-MA 2 Seasons British TV Shows, TV Comedies, TV Dramas Set during the Russian Revolution, this comic ...
6048 70153404 TV Show Friends 0 Jennifer Aniston, Courteney Cox, Lisa Kudrow, ... United States 0 2003 TV-14 10 Seasons Classic & Cult TV, TV Comedies This hit sitcom follows the merry misadventure...

1931 rows × 12 columns

Oldest Series

In [8]:
oldest_series=netflix_shows.sort_values(by='release_year')[0:10]
oldest_series
Out[8]:
show_id type title director cast country date_added release_year rating duration listed_in description
4117 81030762 TV Show Pioneers: First Women Filmmakers* 0 0 0 December 30, 2018 1925 TV-PG 1 Season TV Shows This collection restores films from women who ...
3904 80161851 TV Show Pioneers of African-American Cinema Oscar Micheaux, Spencer Williams, Richard E. N... 0 United States February 1, 2017 1946 TV-14 1 Season TV Shows This newly preserved collection features more ...
5806 70172488 TV Show The Twilight Zone (Original Series) 0 Rod Serling United States July 1, 2017 1963 TV-PG 4 Seasons Classic & Cult TV, TV Sci-Fi & Fantasy Hosted by creator Rod Serling, this groundbrea...
5805 70155574 TV Show The Andy Griffith Show 0 Andy Griffith, Ron Howard, Don Knotts, Frances... United States July 1, 2017 1967 TV-G 8 Seasons Classic & Cult TV, TV Comedies Homespun humor and easygoing Sheriff Andy Tayl...
5529 70136140 TV Show Star Trek 0 William Shatner, Leonard Nimoy, DeForest Kelle... United States October 1, 2017 1968 TV-PG 3 Seasons Classic & Cult TV, TV Action & Adventure, TV S... Led by unflappable Capt. Kirk, the crew of the...
614 80236357 TV Show Monty Python's Fliegender Zirkus 0 Graham Chapman, John Cleese, Eric Idle, Terry ... United Kingdom, West Germany October 2, 2018 1972 TV-14 1 Season International TV Shows, TV Comedies The Pythons elevate the absurd to new heights ...
5494 70213238 TV Show Monty Python's Flying Circus 0 John Cleese, Graham Chapman, Terry Jones, Eric... United Kingdom October 2, 2018 1974 NR 4 Seasons British TV Shows, Classic & Cult TV, Internati... The Monty Python players make their mark with ...
5655 80244567 TV Show Dad's Army 0 Arthur Lowe, John Le Mesurier, Clive Dunn, Joh... United Kingdom March 31, 2018 1977 TV-PG 10 Seasons British TV Shows, Classic & Cult TV, TV Comedies This beloved sitcom follows the unlikely heroe...
4098 70205634 TV Show El Chavo 0 Roberto Gómez Bolaños, María Antonieta de las ... Mexico December 31, 2017 1979 TV-PG 1 Season Classic & Cult TV, Kids' TV, Spanish-Language ... El Chavo is a poor, nameless orphan who lives ...
4194 80153226 TV Show Ninja Hattori 0 Junko Hori, Masako Sugaya, Yuko Mita, Kaneta K... Japan December 23, 2018 1981 TV-Y7 1 Season Anime Series, Kids' TV Elementary school student Kenichi Mitsuba's ho...

Latest Series

In [9]:
latest_series=netflix_shows.sort_values(by='release_year', ascending=False)[0:50]
latest_series
Out[9]:
show_id type title director cast country date_added release_year rating duration listed_in description
2445 81006334 TV Show Super Monsters Monster Pets 0 Erin Mathews, Kathleen Barr, Chiara Zanni, Reb... United States June 7, 2019 2019 TV-Y 1 Season Kids' TV The adorably magical Monster Pets star in a se...
5562 80117560 TV Show Trolls: The Beat Goes On! 0 Amanda Leighton, Skylar Astin, Ron Funches, Da... United States November 22, 2019 2019 TV-G 8 Seasons Kids' TV, TV Comedies As Queen Poppy welcomes a new time of peace in...
1238 81191473 TV Show Candy Online 0 Ruby Zhan, Suun Lin, Sunnie Wang, Dean Tang, L... Taiwan November 17, 2019 2019 TV-MA 1 Season International TV Shows, TV Dramas, Teen TV Shows When a wardrobe malfunction goes viral, a bubb...
5769 80130521 TV Show The Worst Witch 0 Bella Ramsey, Clare Higgins, Meibh Campbell, R... United Kingdom, Germany July 26, 2019 2019 TV-Y7 3 Seasons British TV Shows, Kids' TV After stumbling into a school for witches, a b...
1228 81105522 TV Show No Time for Shame 0 Santiago Artemis Argentina November 19, 2019 2019 TV-MA 1 Season International TV Shows, Reality TV, Spanish-La... Follow Santiago Artemis, a Buenos Aires fashio...
1227 81152642 TV Show Miss Culinary 0 Wanida Termthanaporn, Jason Young, Thanawin Te... 0 November 19, 2019 2019 TV-14 1 Season International TV Shows, Romantic TV Shows, TV ... After ditching her domestic life to become a c...
5576 80161497 TV Show The Toys That Made Us 0 0 United States November 15, 2019 2019 TV-14 3 Seasons Docuseries, Reality TV The minds behind history's most iconic toy fra...
5575 80115338 TV Show Llama Llama 0 Jennifer Garner, Shayle Simons, Vania Gill, Is... United States November 15, 2019 2019 TV-Y 2 Seasons Kids' TV Beloved children's book character Llama Llama ...
4632 80148535 TV Show The Dark Crystal: Age of Resistance 0 Taron Egerton, Nathalie Emmanuel, Anya Taylor-... United Kingdom, United States August 30, 2019 2019 TV-PG 1 Season TV Action & Adventure, TV Dramas, TV Sci-Fi & ... As power-hungry overlords drain life from the ...
2696 80188935 TV Show A Thousand Goodnights 0 Cindy Lien, Nicholas Teo, Yao Ai-ning, Li Chun... Taiwan June 1, 2019 2019 TV-14 1 Season International TV Shows, TV Dramas To carry out her dad's wish and discover her r...
1192 80222157 TV Show Who Killed Little Gregory? 0 0 France November 20, 2019 2019 TV-MA 1 Season Crime TV Shows, Docuseries, International TV S... When their 4-year-old son is murdered, a young...
1174 81011957 TV Show Holiday Secrets 0 Corinna Harfouch, Christiane Paul, Svenja Jung... Germany November 20, 2019 2019 TV-MA 1 Season International TV Shows, TV Dramas A Christmas reunion becomes a gateway to the p...
1163 81152643 TV Show Bangkok Buddies 0 Vayu Kessuvit, Ekapol Deebunmee, Nuttapong Boo... 0 November 20, 2019 2019 TV-14 1 Season International TV Shows, TV Comedies, TV Dramas Living under the same roof, a group of unabash...
5628 70242081 TV Show Arrow James Bamford Stephen Amell, Katie Cassidy, David Ramsey, Wi... United States May 21, 2019 2019 TV-14 7 Seasons Crime TV Shows, TV Action & Adventure Based on DC Comics' Green Arrow, an affluent p...
1152 80241539 TV Show Mortel 0 Carl Malapa, Nemo Schiffman, Manon Bresch, Cor... France November 21, 2019 2019 TV-MA 1 Season Crime TV Shows, International TV Shows, TV Dramas After making a deal with a supernatural figure...
2048 80189898 TV Show Osmosis 0 Agathe Bonitzer, Hugo Becker, Gaël Kamilindi, ... France March 29, 2019 2019 TV-MA 1 Season International TV Shows, TV Dramas, TV Mysteries In near-future Paris, two brilliant siblings u...
5437 80190009 TV Show Fastest Car 0 0 United States September 20, 2019 2019 TV-MA 2 Seasons Reality TV The drivers of exotic supercars put their stre...
1143 80245262 TV Show Singapore Social 0 Nicole Ong, Mae Tan, Sukki Singapora, Vinny Sh... Singapore, United States November 22, 2019 2019 TV-MA 1 Season International TV Shows, Reality TV Peer into the lives of young Singaporeans as t...
1141 80244700 TV Show Nobody's Looking 0 Victor Lamoglia, Júlia Rabello, Kéfera Buchman... Brazil November 22, 2019 2019 TV-MA 1 Season International TV Shows, TV Comedies, TV Dramas A new guardian "angelus" uncovers a secret beh...
1140 81169145 TV Show Narcoworld: Dope Stories 0 0 United States November 22, 2019 2019 TV-MA 1 Season Crime TV Shows, Docuseries Ride along as police officers and drug smuggle...
1137 80244846 TV Show Dolly Parton's Heartstrings 0 Dolly Parton, Julianne Hough, Kimberly William... United States November 22, 2019 2019 TV-14 1 Season TV Dramas Eight stories celebrating family, faith, love ...
1136 80216180 TV Show Dino Girl Gauko 0 Naoko Matsui, Hiroshi Kamiya, Kazue Ikura, Cha... United States, Japan November 22, 2019 2019 TV-Y7-FV 1 Season Anime Series, Kids' TV When she gets angry, middle schooler Naoko tur...
5629 80223556 TV Show Prince of Peoria 0 Gavin Lewis, Theodore Barnes, Shelby Simmons, ... United States May 20, 2019 2019 TV-Y7 2 Seasons Kids' TV, TV Comedies A prankster prince who wants to experience lif...
5570 80025678 TV Show The Crown 0 Claire Foy, John Lithgow, Matt Smith, Vanessa ... United Kingdom, United States November 17, 2019 2019 TV-MA 3 Seasons British TV Shows, International TV Shows, TV D... This drama follows the political rivalries and...
1130 81208888 TV Show Once Upon A Time In Lingjian Mountain 0 Xu Kai, Sandrine Pinna, Ryan Zhu, Gao Yuer, Cr... China November 23, 2019 2019 TV-PG 1 Season International TV Shows, TV Comedies, TV Sci-Fi... As the nine continents face a crisis, a young ...
2053 80223793 TV Show Traitors 0 Emma Appleton, Michael Stuhlbarg, Luke Treadaw... United Kingdom March 29, 2019 2019 TV-MA 1 Season British TV Shows, International TV Shows, TV D... As World War II ends, a young English woman ag...
2446 80211563 TV Show Tales of the City 0 Laura Linney, Ellen Page, Olympia Dukakis, Pau... United States June 7, 2019 2019 TV-MA 1 Season TV Dramas Returning to San Francisco after a long absenc...
4630 80204364 TV Show Styling Hollywood 0 Jason Bolden, Adair Curtis 0 August 30, 2019 2019 TV-14 1 Season Reality TV Whether styling superstars or elevating A-list...
5768 80201328 TV Show Sugar Rush 0 Candace Nelson, Adriano Zumbo, Hunter March United States July 26, 2019 2019 TV-PG 2 Seasons Reality TV Time's the most important ingredient as teams ...
5767 70242311 TV Show Orange Is the New Black 0 Taylor Schilling, Kate Mulgrew, Laura Prepon, ... United States July 26, 2019 2019 TV-MA 7 Seasons TV Comedies, TV Dramas A privileged New Yorker ends up in a women's p...
5761 80217769 TV Show Yummy Mummies 0 Lorinska Merrington, Jane Scandizzo, Rachel Wa... Australia July 3, 2019 2019 TV-14 2 Seasons International TV Shows, Reality TV It's drama Down Under when expectant mothers w...
3007 80210245 TV Show Extreme Engagement 0 Tim Noonan, PJ Madam 0 July 12, 2019 2019 TV-MA 1 Season International TV Shows, Reality TV An engaged couple travels the world for a year...
5755 80233218 TV Show Kakegurui 0 Minami Hamabe, Mahiro Takasugi, Aoi Morikawa Japan July 4, 2019 2019 TV-14 2 Seasons International TV Shows, TV Dramas, TV Thrillers Yumeko Jabami enrolls at Hyakkaou Private Acad...
1325 81200229 TV Show Put Your Head on My Shoulder 0 Fair Xing, Lin Yi, Daddi Tang, Yi Sha, Zhou Zi... China November 11, 2019 2019 TV-PG 1 Season International TV Shows, Romantic TV Shows, Tee... On the cusp of graduation, an accounting major...
5756 80057281 TV Show Stranger Things 0 Winona Ryder, David Harbour, Finn Wolfhard, Mi... United States July 4, 2019 2019 TV-14 3 Seasons TV Horror, TV Mysteries, TV Sci-Fi & Fantasy When a young boy vanishes, a small town uncove...
6000 80223989 TV Show Chilling Adventures of Sabrina 0 Kiernan Shipka, Ross Lynch, Miranda Otto, Lucy... United States April 5, 2019 2019 TV-14 2 Seasons TV Horror, TV Mysteries, TV Sci-Fi & Fantasy Magic and mischief collide as half-human, half...
1310 81163776 TV Show My Dear Warrior 0 Leo Putt, Pimchanok Luevisadpaibul, Suthada Jo... Thailand November 14, 2019 2019 TV-14 1 Season International TV Shows, Romantic TV Shows, TV ... Love leaps off the page when an astronomer mag...
4265 80989919 TV Show Twice Upon A Time 0 Gaspard Ulliel, Freya Mavor France December 19, 2019 2019 TV-MA 1 Season International TV Shows, Romantic TV Shows, TV ... Months after a crushing breakup, a man receive...
5758 80198635 TV Show The Letdown 0 Alison Bell, Duncan Fellows, Noni Hazlehurst, ... Australia July 31, 2019 2019 TV-MA 2 Seasons International TV Shows, TV Comedies, TV Dramas Audrey, mother of a 2-month-old, joins a new-p...
5436 80095697 TV Show Disenchantment 0 Abbi Jacobson, Eric André, Nat Faxon, John DiM... United States September 20, 2019 2019 TV-14 2 Seasons TV Action & Adventure, TV Comedies, TV Sci-Fi ... Princess duties call, but she'd rather be drin...
5580 80239931 TV Show Patriot Act with Hasan Minhaj 0 Hasan Minhaj 0 November 10, 2019 2019 TV-MA 5 Seasons TV Comedies Every Sunday, Hasan Minhaj brings an incisive ...
3014 81094069 TV Show One Spring Night 0 Han Ji-min, Jung Hae-in, Kim Jun-han, Yim Sung... South Korea July 12, 2019 2019 TV-14 1 Season International TV Shows, Korean TV Shows, Roman... When Lee Jeong-in and Yu Ji-ho meet, something...
1281 80242491 TV Show The Stranded 0 Papangkorn Lerkchaleampote, Chayanit Chansanga... Thailand November 15, 2019 2019 TV-MA 1 Season International TV Shows, TV Action & Adventure,... Trapped on an island destroyed by a tsunami, t...
4627 80992137 TV Show CAROLE & TUESDAY 0 Miyuri Shimabukuro, Kana Ichinose, Akio Otsuka... Japan August 30, 2019 2019 TV-MA 1 Season Anime Series, International TV Shows, Teen TV ... Part-timer Carole meets rich girl Tuesday, and...
1279 80238391 TV Show The Club 0 Alejandro Speitzer, Minnie West, Jorge Caballe... Mexico November 15, 2019 2019 TV-MA 1 Season Crime TV Shows, International TV Shows, Spanis... A band of misfit rich kids in Mexico strike ou...
3015 81094893 TV Show PILI Fantasy: War of Dragons 0 Wang Hsi-hua, Lai Wei, Zhang Yu-quan, Chen Yu-... 0 July 12, 2019 2019 TV-14 1 Season International TV Shows, TV Action & Adventure,... As turmoil looms in the Martial World, and the...
3018 81040704 TV Show Taco Chronicles 0 0 United States July 12, 2019 2019 TV-PG 1 Season Docuseries, International TV Shows, Reality TV Many of the most popular taco styles have long...
3020 81056491 TV Show True Tunes 0 Michela Luci, Jamie Watson, Eric Peterson, Ann... 0 July 12, 2019 2019 TV-Y 1 Season Kids' TV True and her friends are dropping sweet, silly...
5578 81070963 TV Show Chief of Staff 0 Lee Jung-jae, Shin Mina, Lee Elijah, Kim Dong-... South Korea November 12, 2019 2019 TV-14 2 Seasons International TV Shows, Korean TV Shows, TV Dr... As a chief of staff in the National Assembly, ...
1269 80217594 TV Show I'm with the Band: Nasty Cherry 0 Charli XCX, Emmie Lichtenberg, Gabbriette Bech... United States November 15, 2019 2019 TV-MA 1 Season Reality TV In an unfiltered, intimate docuseries, pop sta...

Movies

In [10]:
netflix_movies=netflix[netflix['type']=='Movie']
netflix_movies
Out[10]:
show_id type title director cast country date_added release_year rating duration listed_in description
0 81145628 Movie Norm of the North: King Sized Adventure Richard Finn, Tim Maltby Alan Marriott, Andrew Toth, Brian Dobson, Cole... United States, India, South Korea, China September 9, 2019 2019 TV-PG 90 min Children & Family Movies, Comedies Before planning an awesome wedding for his gra...
1 80117401 Movie Jandino: Whatever it Takes 0 Jandino Asporaat United Kingdom September 9, 2016 2016 TV-MA 94 min Stand-Up Comedy Jandino Asporaat riffs on the challenges of ra...
4 80125979 Movie #realityhigh Fernando Lebrija Nesta Cooper, Kate Walsh, John Michael Higgins... United States September 8, 2017 2017 TV-14 99 min Comedies When nerdy high schooler Dani finally attracts...
6 70304989 Movie Automata Gabe Ibáñez Antonio Banderas, Dylan McDermott, Melanie Gri... Bulgaria, United States, Spain, Canada September 8, 2017 2014 R 110 min International Movies, Sci-Fi & Fantasy, Thrillers In a dystopian future, an insurance adjuster f...
7 80164077 Movie Fabrizio Copano: Solo pienso en mi Rodrigo Toro, Francisco Schultz Fabrizio Copano Chile September 8, 2017 2017 TV-MA 60 min Stand-Up Comedy Fabrizio Copano takes audience participation t...
... ... ... ... ... ... ... ... ... ... ... ... ...
5402 80085438 Movie Frank and Cindy G.J. Echternkamp 0 United States April 1, 2016 2007 TV-MA 70 min Documentaries Frank was a rising pop star when he married Ci...
5403 80085439 Movie Frank and Cindy G.J. Echternkamp Rene Russo, Oliver Platt, Johnny Simmons, Jane... United States April 1, 2016 2015 R 102 min Comedies, Dramas, Independent Movies A student filmmaker vengefully turns his camer...
5404 80011846 Movie Iverson Zatella Beatty Allen Iverson United States April 1, 2016 2014 NR 88 min Documentaries, Sports Movies This unfiltered documentary follows the rocky ...
5405 80064521 Movie Jeremy Scott: The People's Designer Vlad Yudin Jeremy Scott United States April 1, 2016 2015 PG-13 109 min Documentaries The journey of fashion designer Jeremy Scott f...
6046 80116008 Movie Little Baby Bum: Nursery Rhyme Friends 0 0 0 0 2016 0 60 min Movies Nursery rhymes and original music for children...

4118 rows × 12 columns

Oldest Movies

In [11]:
oldest_movies=netflix_movies.sort_values(by='release_year')[0:10]
oldest_movies
Out[11]:
show_id type title director cast country date_added release_year rating duration listed_in description
2012 60027942 Movie The Battle of Midway John Ford Henry Fonda, Jane Darwell United States March 31, 2017 1942 TV-G 18 min Classic Movies, Documentaries Director John Ford captures combat footage of ...
2010 60027945 Movie Prelude to War Frank Capra 0 United States March 31, 2017 1942 TV-PG 52 min Classic Movies, Documentaries Frank Capra's documentary chronicles the rise ...
2021 80119186 Movie Undercover: How to Operate Behind Enemy Lines John Ford 0 United States March 31, 2017 1943 TV-PG 61 min Classic Movies, Documentaries This World War II-era training film dramatizes...
2022 70013050 Movie Why We Fight: The Battle of Russia Frank Capra, Anatole Litvak 0 United States March 31, 2017 1943 TV-14 82 min Documentaries This installment of Frank Capra's acclaimed do...
2025 70022548 Movie WWII: Report from the Aleutians John Huston 0 United States March 31, 2017 1943 NR 45 min Documentaries Filmmaker John Huston narrates this Oscar-nomi...
2020 80119189 Movie Tunisian Victory Frank Capra, John Huston, Hugh Stewart, Roy Bo... Burgess Meredith United States, United Kingdom March 31, 2017 1944 TV-PG 76 min Classic Movies, Documentaries British and American troops join forces to lib...
2016 80119194 Movie The Memphis Belle: A Story of a\nFlying Fortress William Wyler 0 United States March 31, 2017 1944 TV-PG 40 min Classic Movies, Documentaries This documentary centers on the crew of the B-...
2018 80119191 Movie The Negro Soldier Stuart Heisler 0 United States March 31, 2017 1944 TV-14 40 min Classic Movies, Documentaries This documentary urged African Americans to en...
2011 80119188 Movie San Pietro John Huston 0 United States March 31, 2017 1945 TV-14 32 min Classic Movies, Documentaries After the Allies invade Italy, the Liri Valley...
2008 80119192 Movie Nazi Concentration Camps George Stevens 0 United States March 31, 2017 1945 TV-MA 59 min Classic Movies, Documentaries Shocking footage shows Nazi concentration camp...

Latest Movies

In [12]:
latest_movies=netflix_movies.sort_values(by='release_year', ascending=False)[0:50]
latest_movies
Out[12]:
show_id type title director cast country date_added release_year rating duration listed_in description
0 81145628 Movie Norm of the North: King Sized Adventure Richard Finn, Tim Maltby Alan Marriott, Andrew Toth, Brian Dobson, Cole... United States, India, South Korea, China September 9, 2019 2019 TV-PG 90 min Children & Family Movies, Comedies Before planning an awesome wedding for his gra...
1097 81194544 Movie Evvarikee Cheppoddu Basava Shankar Eeday Rakesh Varre, Gargeyi, Vamsi raj Nekkanti, D P... India November 27, 2019 2019 TV-14 134 min Comedies, International Movies, Romantic Movies When caste differences throw a wrench into the...
1049 81206389 Movie Oththa Seruppu Size 7 Parthiban Parthiban India November 4, 2019 2019 TV-MA 103 min Dramas, International Movies, Thrillers Taken into custody, a murder suspect's theatri...
1056 81197050 Movie Guatemala: Heart of the Mayan World Luis Ara, Ignacio Jaunsolo Christian Morales 0 November 30, 2019 2019 TV-G 67 min Documentaries, International Movies From Sierra de las Minas to Esquipulas, explor...
1057 81213894 Movie The Zoya Factor Abhishek Sharma Sonam Kapoor, Dulquer Salmaan, Sanjay Kapoor, ... India November 30, 2019 2019 TV-14 135 min Comedies, Dramas, International Movies A goofy copywriter unwittingly convinces the I...
1077 81082007 Movie Atlantics Mati Diop Mama Sane, Amadou Mbow, Ibrahima Traore, Nicol... France, Senegal, Belgium November 29, 2019 2019 TV-14 106 min Dramas, Independent Movies, International Movies Arranged to marry a rich man, young Ada is cru...
1079 81120982 Movie I Lost My Body Jérémy Clapin Hakim Faris, Victoire Du Bois, Patrick d'Assum... France November 29, 2019 2019 TV-MA 81 min Dramas, Independent Movies, International Movies Romance, mystery and adventure intertwine as a...
4282 81070659 Movie Ronny Chieng: Asian Comedian Destroys America! Sebastian DiNatale Ronny Chieng United States December 17, 2019 2019 TV-MA 63 min Stand-Up Comedy Ronny Chieng ("The Daily Show," "Crazy Rich As...
1088 81033086 Movie Holiday Rush Leslie Small Romany Malco, Sonequa Martin-Green, Darlene Lo... United States November 28, 2019 2019 TV-PG 94 min Children & Family Movies, Dramas A widowed radio DJ and his four spoiled kids n...
1098 80995081 Movie Little Singham: Mahabali Prakash Satam Saumya Daan, Sonal Kaushal, Anamaya Verma, Gan... 0 November 27, 2019 2019 TV-Y7 69 min Children & Family Movies, Comedies In a journey back in time to the ancient city ...
1038 81053961 Movie Undercover Brother 2 Leslie Small Michael Jai White, Vince Swann, Barry Bostwick... United States November 5, 2019 2019 R 85 min Comedies When a beloved secret agent falls deep into a ...
1099 81177504 Movie The Body Remembers When the World Broke Open Elle-Máijá Tailfeathers, Kathleen Hepburn Violet Nelson, Elle-Máijá Tailfeathers, Charli... Canada, Norway November 27, 2019 2019 TV-MA 106 min Dramas, Independent Movies After a traumatic event, two Indigenous women ...
1100 80175798 Movie The Irishman Martin Scorsese Robert De Niro, Al Pacino, Joe Pesci, Harvey K... United States November 27, 2019 2019 R 209 min Dramas Hit man Frank Sheeran looks back at the secret...
1105 81062293 Movie Mike Birbiglia: The New One Seth Barrish Mike Birbiglia United States November 26, 2019 2019 TV-MA 86 min Stand-Up Comedy Comedian Mike Birbiglia hits Broadway with a h...
1106 80235524 Movie Super Monsters Save Christmas Steve Ball Elyse Maloway, Vincent Tong, Erin Mathews, And... United States November 26, 2019 2019 TV-Y 24 min Children & Family Movies It's Christmas Eve in Pitchfork Pines, and the...
1107 81035121 Movie True: Winter Wishes 0 Michela Luci, Jamie Watson, Eric Peterson, Ann... 0 November 26, 2019 2019 TV-Y 46 min Movies An ice crystal from a frosty realm is freezing...
1110 81215481 Movie Pranaam Sanjiv Jaiswal Rajeev Khandelwal, Samiksha Singh, S.M. Zaheer... India November 25, 2019 2019 TV-MA 117 min Action & Adventure, Dramas, International Movies Aspiring to fulfill his father’s dream and bec...
1111 81005044 Movie What the F* Is Going On? Marta Jaenes, Rosa Márquez 0 0 November 25, 2019 2019 TV-MA 87 min Documentaries, International Movies Featuring extensive interviews, this documenta...
4321 81135444 Movie Holy Expectations Fernando Ayllón Adriana Botina, Fernando Ramos, Isabella Sierr... 0 December 15, 2019 2019 TV-PG 89 min Children & Family Movies, Comedies, Internatio... With a short life expectancy, a young girl use...
1037 81165326 Movie Tune in for Love Jung Ji-woo Kim Go-eun, Jung Hae-in, Park Hae-joon, Kim Gu... South Korea November 5, 2019 2019 TV-MA 123 min Dramas, International Movies, Romantic Movies A student and a reticent teen first meet at a ...
4550 81091977 Movie Rocko's Modern Life: Static Cling Joe Murray, Cosmo Segurson Carlos Alazraqui, Tom Kenny, Charlie Adler, Ji... United States August 9, 2019 2019 TV-Y7 46 min Children & Family Movies, Comedies, LGBTQ Movies After 20 years in space, Rocko struggles to ad...
4433 81036542 Movie Michelle Wolf: Joke Show Lance Bangs Michelle Wolf United States December 10, 2019 2019 TV-MA 60 min Stand-Up Comedy Comedian Michelle Wolf takes on outrage cultur...
4467 81169158 Movie Wandering Stars Syrine Boulanouar, Nekfeu Nekfeu France December 1, 2019 2019 TV-MA 95 min Documentaries, International Movies, Music & M... Navigating creative pressures and personal ups...
4461 81184705 Movie Tee Shot: Ariya Jutanugarn Tanawat Aiemjinda Krissiri Sukhsvasti, Atchareeya Potipipittanak... 0 December 1, 2019 2019 TV-14 103 min Children & Family Movies, Dramas, Internationa... This biopic follows pro golfer Ariya Jutanugar...
4450 80188823 Movie Iron Fists and Kung-Fu Kicks Serge Ou 0 Australia December 1, 2019 2019 TV-MA 108 min Documentaries, International Movies This documentary examines the influence of Hon...
4448 81217746 Movie High End Yaariyan Pankaj Batra Ninja, Ranjit Bawa, Jassi Gill, Musskan Sethi,... India December 1, 2019 2019 TV-14 120 min Comedies, International Movies, Romantic Movies From romantic pursuits to their friendship, a ...
4447 81165325 Movie Dead Kids Mikhail Red Khalil Ramos, Vance Larena, Kelvin Miranda, Ja... Philippines December 1, 2019 2019 TV-MA 94 min Dramas, International Movies, Thrillers A socially awkward teen bonds with a group of ...
4445 81217745 Movie Baby Dolls Vijay Kumar Arora Nirmal Rishi, Sonam Bajwa, Sukhwinder Chahal, ... India December 1, 2019 2019 TV-14 127 min Comedies, International Movies, Romantic Movies When two sisters travel from Canada to Punjab ...
4440 81148811 Movie A Cinderella Story: Christmas Wish Michelle Johnston Laura Marano, Gregg Sulkin, Isabella Gomez, Jo... United States December 1, 2019 2019 PG 86 min Children & Family Movies, Comedies, Music & Mu... Despite her vain stepmother and mean stepsiste...
4424 81037373 Movie The Sky Is Pink Shonali Bose Rohit Saraf, Zaira Wasim, Farhan Akhtar, Priya... India, United Kingdom, Canada, United States December 11, 2019 2019 TV-14 143 min Dramas, International Movies After succumbing to her terminal illness, a te...
1035 81058497 Movie Seth Meyers: Lobby Baby Neal Brennan Seth Meyers United States November 5, 2019 2019 TV-MA 61 min Stand-Up Comedy SNL alumnus and subversive master of late-nigh...
4413 81060232 Movie Jack Whitehall: Christmas with My Father Richard van't Riet Jack Whitehall, Michael Whitehall, Hugh Bonnev... United Kingdom December 12, 2019 2019 TV-MA 65 min Stand-Up Comedy Jack Whitehall invites his notoriously stuffy ...
4410 81210770 Movie The 9th Precinct Ding-Lin Wang Roy Chiu, Chia-Chia Peng, Wen Chen-ling, Eugen... Taiwan December 13, 2019 2019 TV-14 95 min International Movies, Thrillers An idealistic cop joins an underground police ...
4404 81001887 Movie 6 Underground Michael Bay Ryan Reynolds, Mélanie Laurent, Corey Hawkins,... United States December 13, 2019 2019 R 129 min Action & Adventure, Dramas After faking his death, a tech billionaire rec...
1013 80201542 Movie Let It Snow Luke Snellin Isabela Moner, Shameik Moore, Kiernan Shipka, ... United States November 8, 2019 2019 PG-13 93 min Comedies, Dramas, LGBTQ Movies A snowstorm hits a small town on a cold Christ...
1014 81079723 Movie Paradise Beach Xavier Durringer Sami Bouajila, Tewfik Jallab, Mélanie Doutey, ... France November 8, 2019 2019 TV-MA 94 min Action & Adventure, Dramas, International Movies Mehdi gets out of prison, planning to settle o...
1030 81092045 Movie Burning Cane Phillip Youmans Wendell Pierce, Karen Kaia Livers, Dominique M... United States November 6, 2019 2019 TV-MA 78 min Dramas A small-town Louisiana minister and one of his...
1034 81209203 Movie Luccas Neto in: Summer Camp Lucas Margutti Luccas Neto, Gi Alparone, Jéssica Diehl, Roni ... 0 November 5, 2019 2019 TV-G 87 min Children & Family Movies, Comedies Luccas and Gi are heading to a world famous gy...
1118 81218079 Movie Awake Aleksandr Chernyaev, Fedor Lyass Jonathan Rhys Meyers, Francesca Eastwood, Mali... United States November 24, 2019 2019 TV-MA 92 min Thrillers After an accident leaves him with no recollect...
4264 80244681 Movie After the Raid Rodrigo Reyes 0 United States, Mexico December 19, 2019 2019 TV-PG 25 min Documentaries, International Movies A large immigration raid in a small town leave...
1135 80198859 Movie Brother Julien Abraham MHD, Darren Muselet, Aïssa Maïga, Jalil Lesper... France November 22, 2019 2019 TV-MA 97 min Dramas, Independent Movies, International Movies Thrust from a violent home into a brutal custo...
4122 80221271 Movie Tiffany Haddish: Black Mitzvah Linda Mendoza Tiffany Haddish United States December 3, 2019 2019 TV-MA 56 min Stand-Up Comedy On her 40th birthday, Tiffany Haddish drops a ...
1264 80244457 Movie Earthquake Bird Wash Westmoreland Alicia Vikander, Riley Keough, Naoki Kobayashi... United States November 15, 2019 2019 R 107 min Dramas, Romantic Movies In 1980s Tokyo, an enigmatic expat is suspecte...
1265 81196441 Movie El sendero de la anaconda Alessandro Angulo Wade Davis, Martin von Hildebrand Colombia November 15, 2019 2019 TV-PG 74 min Documentaries, International Movies In the most remote areas of the Amazon jungle,...
1266 81162089 Movie GO! The Unforgettable Party Mauro Scandolari Pilar Pascual, José Gimenez Zapiola, Renata To... Argentina November 15, 2019 2019 TV-PG 60 min Children & Family Movies, Music & Musicals Mía's vacation with her dad is disrupted by th...
1267 81217737 Movie Guna 369 Arjun Jandyala Adithya Menon, Kartikeya Gummakonda, Anagha LK India November 15, 2019 2019 TV-MA 143 min Action & Adventure, Dramas, International Movies A pampered but kind-hearted average joe ditche...
1268 81076114 Movie House Arrest Shashanka Ghosh, Samit Basu Ali Fazal, Shriya Pilgaonkar, Jim Sarbh, Barkh... India November 15, 2019 2019 TV-14 105 min Comedies, Independent Movies, International Mo... A world-weary man’s self-imposed home confinem...
4124 81167490 Movie Wish Man Theo Davies Andrew Steel, Kirby Bliss Blanton, Tom Sizemor... United States December 3, 2019 2019 TV-14 108 min Children & Family Movies, Dramas After surviving a life-threatening accident, a...
1272 80183187 Movie Klaus Sergio Pablos Jason Schwartzman, J.K. Simmons, Rashida Jones... Spain November 15, 2019 2019 PG 98 min Children & Family Movies, Comedies A selfish postman and a reclusive toymaker for...
4121 81078397 Movie The First Temptation of Christ Rodrigo Van Der Put Gregorio Duvivier, Fábio Porchat, Antonio Tabe... Brazil December 3, 2019 2019 TV-MA 46 min Comedies, International Movies Jesus, who's hitting the big 3-0, brings a sur...

Overall Content Update Analysis

In [13]:
netflix_date = netflix_tiles[['date_added']].dropna()
netflix_date['year'] = netflix_date['date_added'].apply(lambda x : x.split(', ')[-1])
netflix_date['month'] = netflix_date['date_added'].apply(lambda x : x.lstrip().split(' ')[0])
month_order = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'][::-1]
df = netflix_date.groupby('year')['month'].value_counts().unstack().fillna(0)[month_order].T
fig=px.imshow(df,color_continuous_scale=px.colors.sequential.Reds,aspect='auto',template='plotly_dark',width=1000,height=1000,title='Netflix Content Update')
fig.show()

Year Wise Analysis

Overall

In [14]:
yearly_content=netflix[['type','release_year']]
yearly_content=yearly_content.rename(columns={"release_year": "Release Year"})
yc=yearly_content.groupby(['Release Year','type']).size().reset_index(name='Total Content')
yc=yc[yc['Release Year']>=2010]
fig= px.line(yc, x="Release Year", y="Total Content",color='type', title='Trend of content produced over the years on Netflix',color_discrete_sequence=px.colors.sequential.Reds_r,template='plotly_dark',width=1000,height=400)
fig.show()

Shows

In [15]:
fig = px.violin(netflix_shows, x='release_year',color_discrete_sequence=px.colors.cyclical.HSV,template='plotly_dark',points='all',title='Year-wise Analysis of TV Shows')
fig.show()

Movies

In [16]:
fig=px.violin(netflix_movies, x='release_year',color_discrete_sequence=px.colors.cyclical.HSV,template='plotly_dark',points='all',title='Year-wise Analysis of Movies')
fig.show()

How Netflix Content Count Soared?

In [17]:
year_data = netflix['release_year'].value_counts().sort_index().loc[:2019]
type_data = netflix.groupby('type')['release_year'].value_counts().sort_index().unstack().fillna(0).T.loc[:2019] 

fig, ax = plt.subplots(1,1, figsize=(28, 15))
ax.plot(year_data.index, year_data,  color="maroon", linewidth=5, label='Total', path_effects=[path_effects.SimpleLineShadow(),
                       path_effects.Normal()])
ax.plot(type_data.index, type_data['Movie'], color='red', linewidth=5, label='Movie', path_effects=[path_effects.SimpleLineShadow(),
                       path_effects.Normal()])
ax.plot(type_data.index, type_data['TV Show'], color='salmon', linewidth=5, label='TV Show', path_effects=[path_effects.SimpleLineShadow(),
                       path_effects.Normal()])

ax.set_xlim(2006, 2020)
ax.set_ylim(-40, 2700)

t = [
    2008,
    2010.8,
    2012.1,
    2013.1,
    2015.7,
    2016.1,
    2016.9
]

events = [
    "Launch Streaming Video\n2007.1",
    "Expanding Streaming Service\nStarting with Candata | 2010.11",
    "Expanding to Europe\n2012.1",
    "First Original Content\n2013.2",
    "Expanding to Japan\n2015.9",
    "Original targeting Kids\n2016/1",
    "Offline Playback Features to all of Users\n2016/11"
]

up_down = [100, 110, 280, 110, 0, 0, 0]

left_right = [ -1, 0, 0, 0, 1, 1, 1.6 ]

for t_i, event_i, ud_i, lr_i in zip(t, events, up_down, left_right):
    ax.annotate(event_i,
                xy=(t_i + lr_i, year_data[int(t_i)] * (int(t_i+1)-t_i) + year_data[int(t_i)+1]  * (t_i-int(t_i)) + ud_i),
                xytext=(0,0), textcoords='offset points',
                va="center", ha="center",
                color="w", fontsize=16,
                bbox=dict(boxstyle='round4', pad=0.5, color='#303030', alpha=0.90))
    
    ax.scatter(t_i, year_data[int(t_i)] * (int(t_i+1)-t_i) + year_data[int(t_i)+1]  * (t_i-int(t_i)), color='#E50914', s=300)

ax.set_facecolor((0.4, 0.4, 0.4))
ax.set_title("Why Netflix's Contents Count Soared?", position=(0.23, 1.0+0.03), fontsize=30, fontweight='bold')
ax.yaxis.set_tick_params(labelsize=20)
ax.xaxis.set_tick_params(labelsize=20)
plt.legend(loc='upper left', fontsize=20)
plt.figure(figsize=(1,1))
plt.show()
<Figure size 72x72 with 0 Axes>

Month-wise Analysis

In [18]:
monthly_content=pd.DatetimeIndex(netflix_shows.date_added).month.value_counts().sort_index()
order=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']
fig= px.histogram(monthly_content,x=order,y=monthly_content.values,
                  title='Distribution of Netflix Content On Months',color='date_added',
                  color_discrete_sequence=px.colors.sequential.Reds_r,template='plotly_dark')
fig.show()

Day-wise Analysis

In [19]:
netflix['weekday'] = pd.DatetimeIndex(netflix.date_added).weekday
daily_content=netflix.weekday.value_counts().sort_index()
order=['Mon','Tue','Wed','Thu','Fri','Sat','Sun']
fig= px.histogram(daily_content,x=order,y=daily_content.values,
                  title='Distribution of Netflix Content On Days Of Week',color='weekday',
                  color_discrete_sequence=px.colors.sequential.Reds_r,template='plotly_dark')
fig.show()

Country-wise Analaysis

In [20]:
country_codes = {'afghanistan': 'AFG',
 'albania': 'ALB',
 'algeria': 'DZA',
 'american samoa': 'ASM',
 'andorra': 'AND',
 'angola': 'AGO',
 'anguilla': 'AIA',
 'antigua and barbuda': 'ATG',
 'argentina': 'ARG',
 'armenia': 'ARM',
 'aruba': 'ABW',
 'australia': 'AUS',
 'austria': 'AUT',
 'azerbaijan': 'AZE',
 'bahamas': 'BHM',
 'bahrain': 'BHR',
 'bangladesh': 'BGD',
 'barbados': 'BRB',
 'belarus': 'BLR',
 'belgium': 'BEL',
 'belize': 'BLZ',
 'benin': 'BEN',
 'bermuda': 'BMU',
 'bhutan': 'BTN',
 'bolivia': 'BOL',
 'bosnia and herzegovina': 'BIH',
 'botswana': 'BWA',
 'brazil': 'BRA',
 'british virgin islands': 'VGB',
 'brunei': 'BRN',
 'bulgaria': 'BGR',
 'burkina faso': 'BFA',
 'burma': 'MMR',
 'burundi': 'BDI',
 'cabo verde': 'CPV',
 'cambodia': 'KHM',
 'cameroon': 'CMR',
 'canada': 'CAN',
 'cayman islands': 'CYM',
 'central african republic': 'CAF',
 'chad': 'TCD',
 'chile': 'CHL',
 'china': 'CHN',
 'colombia': 'COL',
 'comoros': 'COM',
 'congo democratic': 'COD',
 'Congo republic': 'COG',
 'cook islands': 'COK',
 'costa rica': 'CRI',
 "cote d'ivoire": 'CIV',
 'croatia': 'HRV',
 'cuba': 'CUB',
 'curacao': 'CUW',
 'cyprus': 'CYP',
 'czech republic': 'CZE',
 'denmark': 'DNK',
 'djibouti': 'DJI',
 'dominica': 'DMA',
 'dominican republic': 'DOM',
 'ecuador': 'ECU',
 'egypt': 'EGY',
 'el salvador': 'SLV',
 'equatorial guinea': 'GNQ',
 'eritrea': 'ERI',
 'estonia': 'EST',
 'ethiopia': 'ETH',
 'falkland islands': 'FLK',
 'faroe islands': 'FRO',
 'fiji': 'FJI',
 'finland': 'FIN',
 'france': 'FRA',
 'french polynesia': 'PYF',
 'gabon': 'GAB',
 'gambia, the': 'GMB',
 'georgia': 'GEO',
 'germany': 'DEU',
 'ghana': 'GHA',
 'gibraltar': 'GIB',
 'greece': 'GRC',
 'greenland': 'GRL',
 'grenada': 'GRD',
 'guam': 'GUM',
 'guatemala': 'GTM',
 'guernsey': 'GGY',
 'guinea-bissau': 'GNB',
 'guinea': 'GIN',
 'guyana': 'GUY',
 'haiti': 'HTI',
 'honduras': 'HND',
 'hong kong': 'HKG',
'hungary': 'HUN',
 'iceland': 'ISL',
 'india': 'IND',
 'indonesia': 'IDN',
 'iran': 'IRN',
 'iraq': 'IRQ',
 'ireland': 'IRL',
 'isle of man': 'IMN',
 'israel': 'ISR',
 'italy': 'ITA',
 'jamaica': 'JAM',
 'japan': 'JPN',
 'jersey': 'JEY',
 'jordan': 'JOR',
 'kazakhstan': 'KAZ',
 'kenya': 'KEN',
 'kiribati': 'KIR',
 'north korea': 'PRK',
 'south korea': 'KOR',
 'kosovo': 'KSV',
 'kuwait': 'KWT',
 'kyrgyzstan': 'KGZ',
 'laos': 'LAO',
 'latvia': 'LVA',
 'lebanon': 'LBN',
 'lesotho': 'LSO',
'liberia': 'LBR',
 'libya': 'LBY',
 'liechtenstein': 'LIE',
 'lithuania': 'LTU',
 'luxembourg': 'LUX',
 'macau': 'MAC',
 'macedonia': 'MKD',
 'madagascar': 'MDG',
 'malawi': 'MWI',
 'malaysia': 'MYS',
 'maldives': 'MDV',
 'mali': 'MLI',
 'malta': 'MLT',
 'marshall islands': 'MHL',
 'mauritania': 'MRT',
 'mauritius': 'MUS',
 'mexico': 'MEX',
 'micronesia': 'FSM',
 'moldova': 'MDA',
 'monaco': 'MCO',
 'mongolia': 'MNG',
 'montenegro': 'MNE',
 'morocco': 'MAR',
 'mozambique': 'MOZ',
 'namibia': 'NAM',
 'nepal': 'NPL',
 'netherlands': 'NLD',
 'new cdonia': 'NCL',
 'new zealand': 'NZL',
'nicaragua': 'NIC',
 'nigeria': 'NGA',
 'niger': 'NER',
 'niue': 'NIU',
 'northern mariana islands': 'MNP',
 'norway': 'NOR',
 'oman': 'OMN',
 'pakistan': 'PAK',
 'palau': 'PLW',
 'panama': 'PAN',
 'papua new guinea': 'PNG',
 'paraguay': 'PRY',
 'peru': 'PER',
 'philippines': 'PHL',
 'poland': 'POL',
 'portugal': 'PRT',
 'puerto rico': 'PRI',
 'qatar': 'QAT',
 'romania': 'ROU',
 'russia': 'RUS',
 'rwanda': 'RWA',
 'saint kitts and nevis': 'KNA',
 'saint lucia': 'LCA',
 'saint martin': 'MAF',
 'saint pierre and miquelon': 'SPM',
 'saint vincent and the grenadines': 'VCT',
 'samoa': 'WSM',
 'san marino': 'SMR',
 'sao tome and principe': 'STP',
 'saudi arabia': 'SAU',
 'senegal': 'SEN',
'nicaragua': 'NIC',
 'nigeria': 'NGA',
 'niger': 'NER',
 'niue': 'NIU',
 'northern mariana islands': 'MNP',
 'norway': 'NOR',
 'oman': 'OMN',
 'pakistan': 'PAK',
 'palau': 'PLW',
 'panama': 'PAN',
 'papua new guinea': 'PNG',
 'paraguay': 'PRY',
 'peru': 'PER',
 'philippines': 'PHL',
 'poland': 'POL',
 'portugal': 'PRT',
 'puerto rico': 'PRI',
 'qatar': 'QAT',
 'romania': 'ROU',
 'russia': 'RUS',
 'rwanda': 'RWA',
 'saint kitts and nevis': 'KNA',
 'saint lucia': 'LCA',
 'saint martin': 'MAF',
 'saint pierre and miquelon': 'SPM',
 'saint vincent and the grenadines': 'VCT',
 'samoa': 'WSM',
 'san marino': 'SMR',
 'sao tome and principe': 'STP',
 'saudi arabia': 'SAU',
 'senegal': 'SEN',
 'uganda': 'UGA',
 'ukraine': 'UKR',
 'united arab emirates': 'ARE',
 'united kingdom': 'GBR',
 'united states': 'USA',
 'uruguay': 'URY',
 'uzbekistan': 'UZB',
 'vanuatu': 'VUT',
 'venezuela': 'VEN',
 'vietnam': 'VNM',
 'virgin islands': 'VGB',
 'west bank': 'WBG',
 'yemen': 'YEM',
 'zambia': 'ZMB',
 'zimbabwe': 'ZWE'}
## countries 

def geoplot(netflix_tiles):
    country_with_code, country = {}, {}
    shows_countries = ", ".join(netflix_tiles['country'].dropna()).split(", ")
    for c,v in dict(Counter(shows_countries)).items():
        code = ""
        if c.lower() in country_codes:
            code = country_codes[c.lower()]
        country_with_code[code] = v
        country[c] = v

    data = [dict(
            type = 'choropleth',
            locations = list(country_with_code.keys()),
            z = list(country_with_code.values()),
            color_continuous_scale=px.colors.cyclical.HSV,
            autocolorscale = False,
            reversescale = True,
            marker = dict(
                 line = dict (
                    color = 'gray',
                    width = 0.5
                ) ),
            colorbar = dict(
                autotick = False,
                title = ''),
          ) ]

    layout = dict(
        title = '',
        geo = dict(
            showframe = False,
            showcoastlines = False,
            projection = dict(
                type = 'Mercator'
            )
        )
    )

    fig = dict( data=data, layout=layout )
    iplot( fig, validate=False, filename='d3-world-map' )
    return country

country_vals = geoplot(netflix_tiles)
tabs = Counter(country_vals).most_common(25)

labels = [_[0] for _ in tabs][::-1]
values = [_[1] for _ in tabs][::-1]
plot = go.Bar(y=labels, x=values, orientation="h", name="", marker=dict(color="#d73030"))

data = [plot]
layout = go.Layout(title="Countries with most content", height=700, legend=dict(x=0.1, y=1.1, orientation="h"),template='plotly_dark')
fig = go.Figure(data, layout=layout)
fig.show()
In [21]:
year_country2 = netflix.groupby('release_year')['country'].value_counts().reset_index(name='counts')

fig = px.choropleth(year_country2, locations='country', color='counts', 
                    locationmode='country names',
                    animation_frame='release_year',
                    range_color=[0,200],
                    color_continuous_scale=px.colors.sequential.Reds, template='plotly_dark')

fig.update_layout(title='Comparison by country')
fig.show()

India

In [22]:
netflix_india=netflix_tiles[netflix['country']=='India'].dropna()
netflix_india
Out[22]:
show_id type title director cast country date_added release_year rating duration listed_in description
35 81154455 Movie Article 15 Anubhav Sinha Ayushmann Khurrana, Nassar, Manoj Pahwa, Kumud... India September 6, 2019 2019 TV-MA 125 min Dramas, International Movies, Thrillers The grim realities of caste discrimination com...
37 81052275 Movie Ee Nagaraniki Emaindi Tharun Bhascker Vishwaksen Naidu, Sushanth Reddy, Abhinav Goma... India September 6, 2019 2018 TV-14 133 min Comedies, International Movies In Goa and in desperate need of cash, four chi...
41 70303496 Movie PK Rajkumar Hirani Aamir Khan, Anuskha Sharma, Sanjay Dutt, Saura... India September 6, 2018 2014 TV-14 146 min Comedies, Dramas, International Movies Aamir Khan teams with director Rajkumar Hirani...
58 81155784 Movie Watchman A. L. Vijay G.V. Prakash Kumar, Samyuktha Hegde, Suman, Ra... India September 4, 2019 2019 TV-14 93 min Comedies, Dramas, International Movies Rushing to pay off a loan shark, a young man b...
109 81177238 Movie Malaal Mangesh Hadawale Meezaan Jaffrey, Sharmin Segal, Chinmaya Surve... India September 26, 2019 2019 TV-14 133 min International Movies, Romantic Movies Class divides become thorns in the budding rom...
... ... ... ... ... ... ... ... ... ... ... ... ...
5365 80124313 Movie Sairat Nagraj Manjule Rinku Rajguru, Akash Thosar, Arbaz Shaikh, Tan... India April 1, 2018 2016 TV-14 173 min Dramas, International Movies, Romantic Movies When two college students – a rich man’s daugh...
5377 80170612 Movie Celluloid Man Shivendra Singh Dungarpur P.K. Nair India April 1, 2017 2012 TV-PG 156 min Documentaries, International Movies This documentary chronicles the philosophy and...
5382 80158482 Movie Elaan K. Ramanlal Vinod Mehra, Rekha, Vinod Khanna, Helen, Madan... India April 1, 2017 1971 TV-PG 143 min Action & Adventure, Cult Movies, International... Journalist Naresh is hired to probe illegal ac...
5387 70302835 Movie Killa Avinash Arun Amruta Subhash, Archit Deodhar, Parth Bhalerao... India April 1, 2017 2014 TV-14 107 min Dramas, International Movies Growing up poses challenges for Chinu when he ...
5393 80158479 Movie Salaakhen A. Salaam Shashi Kapoor, Sulakshana Pandit, Mehmood, Sud... India April 1, 2017 1975 TV-14 134 min Action & Adventure, International Movies, Musi... Two close childhood friends take drastically d...

700 rows × 12 columns

Oldest Shows

In [23]:
netflix_india_shows=netflix_shows[netflix['country']=='India']
oldest_indian_show=netflix_india_shows.sort_values(by='release_year')[0:10]
oldest_indian_show
C:\Users\Prashant\anaconda3\lib\site-packages\ipykernel_launcher.py:1: UserWarning:

Boolean Series key will be reindexed to match DataFrame index.

Out[23]:
show_id type title director cast country date_added release_year rating duration listed_in description
2737 80121872 TV Show Jhansi Ki Rani 0 Ulka Gupta, Sameer Dharmadhikari, Amit Pachori... India June 1, 2017 2009 TV-14 1 Season International TV Shows, TV Dramas In British-ruled, 19th-century India, a 14-yea...
2358 80235325 TV Show Mahi Way 0 Pushtii Shakti, Viraf Patel, Siddhant Karnick,... India March 1, 2018 2010 TV-14 1 Season International TV Shows, TV Comedies Though worried she's doomed to be single forev...
3789 80235135 TV Show Powder 0 Manish Chaudhary, Pankaj Tripathi, Geetika Tya... India February 15, 2018 2010 TV-14 1 Season Crime TV Shows, International TV Shows, TV Dramas Two men who grew up in Mumbai's slums are draw...
2209 80234795 TV Show Rishta.com 0 Shruti Seth, Kavi Shastri, Siddhant Karnick, K... India March 15, 2018 2010 TV-14 1 Season International TV Shows, Romantic TV Shows, TV ... Partners at an Indian matrimonial agency face ...
2199 80235139 TV Show Khotey Sikkey 0 Vikas Kumar, Hassan Zaidi, Sukhmani Sadana, Pu... India March 15, 2018 2011 TV-14 1 Season Crime TV Shows, International TV Shows, TV Dramas Five affluent youths find a new sense of purpo...
5363 80122233 TV Show Ramayan 0 Gagan Malik, Neha Sargam, Neil Bhatt India April 1, 2018 2012 TV-14 1 Season International TV Shows, TV Dramas A prince's divine destiny to rule as a king is...
1761 80122237 TV Show Classic Legends 0 Javed Akhtar India May 15, 2017 2012 TV-PG 1 Season Docuseries, International TV Shows This documentary series explores the glamour o...
5386 80122240 TV Show Khelti Hai Zindagi Aankh Micholi 0 Ulka Gupta, Gautami Kapoor, Reema Shaikh, Vina... India April 1, 2017 2013 TV-14 1 Season International TV Shows, TV Dramas The life of a 14-year-old girl is thrown into ...
5372 80122193 TV Show Badalte Rishton Ki Dastaan 0 Additi Gupta, Sanjeeda Sheikh, Kiran Karmarkar... India April 1, 2017 2013 TV-14 1 Season International TV Shows, TV Dramas When a man is killed, his wife and his lover –...
5336 80122234 TV Show Bh Se Bhade 0 Deven Bhojani, Suchita Trivedi, Sarita Joshi, ... India April 1, 2018 2013 TV-PG 1 Season International TV Shows, TV Comedies A kind-hearted insurance agent has the mysteri...

Oldest Movie

In [24]:
netflix_india_movies=netflix_movies[netflix['country']=='India']
oldest_indian_movie=netflix_india_movies.sort_values(by='release_year')[0:10]
oldest_indian_movie
C:\Users\Prashant\anaconda3\lib\site-packages\ipykernel_launcher.py:1: UserWarning:

Boolean Series key will be reindexed to match DataFrame index.

Out[24]:
show_id type title director cast country date_added release_year rating duration listed_in description
713 80158391 Movie Ujala Naresh Saigal Mala Sinha, Shammi Kapoor, Raaj Kumar, Leela C... India October 15, 2017 1959 TV-PG 143 min Dramas, International Movies An honest man dreams of a better life for his ...
3152 20257393 Movie Professor Lekh Tandon Shammi Kapoor, Kalpana, Lalita Pawar, Parveen ... India July 1, 2017 1962 TV-PG 163 min Comedies, Dramas, International Movies A college grad in need of money must disguise ...
4052 60002818 Movie Sangam Raj Kapoor Raj Kapoor, Vyjayanthimala, Rajendra Kumar, La... India December 31, 2019 1964 TV-14 228 min Classic Movies, Dramas, International Movies Returning home from war after being assumed de...
3137 80158390 Movie Amrapali Lekh Tandon Vyjayantimala, Sunil Dutt, Prem Nath, Bipin Gu... India July 1, 2017 1966 TV-PG 116 min Dramas, International Movies, Music & Musicals In the age of Buddha and his philosophy of non...
2748 80158546 Movie Prince Lekh Tandon Shammi Kapoor, Vyjayantimala, Rajendra Nath, A... India June 1, 2017 1969 TV-14 152 min Dramas, International Movies, Romantic Movies To better himself, a spoiled prince temporaril...
3146 80158481 Movie Lal Patthar Sushil Majumdar Raaj Kumar, Hema Malini, Rakhee Gulzar, Vinod ... India July 1, 2017 1971 TV-PG 153 min Classic Movies, Dramas, International Movies A vain, self-righteous nobleman falls in love ...
5382 80158482 Movie Elaan K. Ramanlal Vinod Mehra, Rekha, Vinod Khanna, Helen, Madan... India April 1, 2017 1971 TV-PG 143 min Action & Adventure, Cult Movies, International... Journalist Naresh is hired to probe illegal ac...
4004 60003405 Movie Bawarchi Hrishikesh Mukherjee Rajesh Khanna, A.K. Hangal, Durga Khote, Jaya ... India December 31, 2019 1972 TV-PG 125 min Classic Movies, Comedies, Dramas A dysfunctional middle-class family is transfo...
4035 24073896 Movie Koshish Gulzar Sanjeev Kumar, Jaya Bhaduri, Asrani, Seema, Om... India December 31, 2019 1972 TV-14 115 min International Movies, Romantic Movies A speech and hearing-impaired couple persists ...
4009 70005055 Movie Bobby Raj Kapoor Rishi Kapoor, Dimple Kapadia, Pran, Prem Nath,... India December 31, 2019 1973 TV-14 168 min Classic Movies, Dramas, International Movies Raj, the son of strict, wealthy parents, falls...

Average Indian Movie Duration

In [25]:
Ind_movie_length_min=netflix.loc[(netflix.type=='Movie') & (netflix.country=='India')].duration.str.replace(' min','')  
Ind_Average_movie_length= (Ind_movie_length_min.astype(float).mean())      
print('Average movie length in India is {:0.2f} min'.format(Ind_Average_movie_length))  
Average movie length in India is 127.75 min

Genres watched in India

In [26]:
def Genre(df,condition,column_name):       
    result=pd.Series(df.loc[condition][column_name].dropna().str.split(', ').sum()).value_counts()
    return result
condition = (netflix_tiles.country.str.contains('India'))&(netflix_tiles.type=='TV Show')
column_name ="listed_in"      
Genre(netflix_tiles,condition,column_name)  
Out[26]:
International TV Shows          47
TV Dramas                       20
TV Comedies                     15
Romantic TV Shows                6
TV Horror                        6
Crime TV Shows                   6
Docuseries                       5
Kids' TV                         5
TV Action & Adventure            4
TV Mysteries                     3
TV Thrillers                     3
TV Sci-Fi & Fantasy              3
Reality TV                       2
TV Shows                         2
Teen TV Shows                    1
Stand-Up Comedy & Talk Shows     1
dtype: int64

Top 15 Actors/Actresses Casted

In [27]:
pd.Series(netflix_india.cast.dropna().str.split(', ').sum()).value_counts().head(15)
Out[27]:
Anupam Kher         31
Shah Rukh Khan      27
Akshay Kumar        25
Amitabh Bachchan    24
Naseeruddin Shah    23
Paresh Rawal        23
Om Puri             22
Boman Irani         19
Kareena Kapoor      18
Kay Kay Menon       16
Rajpal Yadav        15
Asrani              15
Saif Ali Khan       14
Salman Khan         14
Gulshan Grover      14
dtype: int64

Top Directors

In [28]:
pd.Series(netflix_india.director.dropna().str.split(', ').sum()).value_counts().head(15)
Out[28]:
David Dhawan                 8
S.S. Rajamouli               7
Dibakar Banerjee             6
Ram Gopal Varma              6
Madhur Bhandarkar            5
Ashutosh Gowariker           5
Umesh Mehra                  5
Rajiv Mehra                  5
Zoya Akhtar                  5
Gajendra Ahire               5
Vishal Bhardwaj              5
Mastan Alibhai Burmawalla    5
Priyadarshan                 5
Abbas Alibhai Burmawalla     5
Subhash Ghai                 4
dtype: int64

Content Contributed By India

In [29]:
netflix_indiam =netflix_tiles[netflix['country']=='India']
india_content=netflix_indiam[['type','release_year']]
india_content=india_content.rename(columns={"release_year": "Release Year"})
indian_content=india_content.groupby(['Release Year','type']).size().reset_index(name='Total Content')
indian_content=indian_content[indian_content['Release Year']>=2010]
fig3 = px.line(indian_content, x="Release Year", y="Total Content",color='type', title='Content produced by India over the years on Netflix',color_discrete_sequence=px.colors.sequential.Reds_r,template='plotly_dark')
fig3.show()

USA

In [30]:
netflix_usa=netflix_tiles[netflix['country']=='United States']
netflix_usa
Out[30]:
show_id type title director cast country date_added release_year rating duration listed_in description
2 70234439 TV Show Transformers Prime NaN Peter Cullen, Sumalee Montano, Frank Welker, J... United States September 8, 2018 2013 TV-Y7-FV 1 Season Kids' TV With the help of three human allies, the Autob...
3 80058654 TV Show Transformers: Robots in Disguise NaN Will Friedle, Darren Criss, Constance Zimmer, ... United States September 8, 2018 2016 TV-Y7 1 Season Kids' TV When a prison ship crash unleashes hundreds of...
4 80125979 Movie #realityhigh Fernando Lebrija Nesta Cooper, Kate Walsh, John Michael Higgins... United States September 8, 2017 2017 TV-14 99 min Comedies When nerdy high schooler Dani finally attracts...
8 80117902 TV Show Fire Chasers NaN NaN United States September 8, 2017 2017 TV-MA 1 Season Docuseries, Science & Nature TV As California's 2016 fire season rages, brave ...
20 80060297 Movie Manhattan Romance Tom O'Brien Tom O'Brien, Katherine Waterston, Caitlin Fitz... United States September 8, 2017 2014 TV-14 98 min Comedies, Independent Movies, Romantic Movies A filmmaker working on a documentary about lov...
... ... ... ... ... ... ... ... ... ... ... ... ...
6040 70153412 TV Show Frasier NaN Kelsey Grammer, Jane Leeves, David Hyde Pierce... United States NaN 2003 TV-PG 11 Seasons Classic & Cult TV, TV Comedies Frasier Crane is a snooty but lovable Seattle ...
6041 70243132 TV Show La Familia P. Luche NaN Eugenio Derbez, Consuelo Duval, Luis Manuel Áv... United States NaN 2012 TV-14 3 Seasons International TV Shows, Spanish-Language TV Sh... This irreverent sitcom featues Ludovico, Feder...
6044 80000063 TV Show Red vs. Blue NaN Burnie Burns, Jason Saldaña, Gustavo Sorola, G... United States NaN 2015 NR 13 Seasons TV Action & Adventure, TV Comedies, TV Sci-Fi ... This parody of first-person shooter games, mil...
6045 70286564 TV Show Maron NaN Marc Maron, Judd Hirsch, Josh Brener, Nora Zeh... United States NaN 2016 TV-MA 4 Seasons TV Comedies Marc Maron stars as Marc Maron, who interviews...
6048 70153404 TV Show Friends NaN Jennifer Aniston, Courteney Cox, Lisa Kudrow, ... United States NaN 2003 TV-14 10 Seasons Classic & Cult TV, TV Comedies This hit sitcom follows the merry misadventure...

1948 rows × 12 columns

In [31]:
netflix_american_movies=netflix_movies[netflix['country']=='United States']
oldest_american_movie=netflix_usa.sort_values(by='release_year')[0:10]
oldest_american_movie
C:\Users\Prashant\anaconda3\lib\site-packages\ipykernel_launcher.py:1: UserWarning:

Boolean Series key will be reindexed to match DataFrame index.

Out[31]:
show_id type title director cast country date_added release_year rating duration listed_in description
2010 60027945 Movie Prelude to War Frank Capra NaN United States March 31, 2017 1942 TV-PG 52 min Classic Movies, Documentaries Frank Capra's documentary chronicles the rise ...
2012 60027942 Movie The Battle of Midway John Ford Henry Fonda, Jane Darwell United States March 31, 2017 1942 TV-G 18 min Classic Movies, Documentaries Director John Ford captures combat footage of ...
2022 70013050 Movie Why We Fight: The Battle of Russia Frank Capra, Anatole Litvak NaN United States March 31, 2017 1943 TV-14 82 min Documentaries This installment of Frank Capra's acclaimed do...
2025 70022548 Movie WWII: Report from the Aleutians John Huston NaN United States March 31, 2017 1943 NR 45 min Documentaries Filmmaker John Huston narrates this Oscar-nomi...
2021 80119186 Movie Undercover: How to Operate Behind Enemy Lines John Ford NaN United States March 31, 2017 1943 TV-PG 61 min Classic Movies, Documentaries This World War II-era training film dramatizes...
2018 80119191 Movie The Negro Soldier Stuart Heisler NaN United States March 31, 2017 1944 TV-14 40 min Classic Movies, Documentaries This documentary urged African Americans to en...
2016 80119194 Movie The Memphis Belle: A Story of a\nFlying Fortress William Wyler NaN United States March 31, 2017 1944 TV-PG 40 min Classic Movies, Documentaries This documentary centers on the crew of the B-...
2004 80119190 Movie Know Your Enemy - Japan Frank Capra, Joris Ivens Walter Huston, Dana Andrews United States March 31, 2017 1945 TV-14 63 min Classic Movies, Documentaries Though culturally insensitive by modern standa...
2008 80119192 Movie Nazi Concentration Camps George Stevens NaN United States March 31, 2017 1945 TV-MA 59 min Classic Movies, Documentaries Shocking footage shows Nazi concentration camp...
2011 80119188 Movie San Pietro John Huston NaN United States March 31, 2017 1945 TV-14 32 min Classic Movies, Documentaries After the Allies invade Italy, the Liri Valley...
In [32]:
netflix_american_shows=netflix_shows[netflix['country']=='United States']
oldest_american_show=netflix_american_shows.sort_values(by='release_year')[0:10]
oldest_american_show
C:\Users\Prashant\anaconda3\lib\site-packages\ipykernel_launcher.py:1: UserWarning:

Boolean Series key will be reindexed to match DataFrame index.

Out[32]:
show_id type title director cast country date_added release_year rating duration listed_in description
3904 80161851 TV Show Pioneers of African-American Cinema Oscar Micheaux, Spencer Williams, Richard E. N... 0 United States February 1, 2017 1946 TV-14 1 Season TV Shows This newly preserved collection features more ...
5806 70172488 TV Show The Twilight Zone (Original Series) 0 Rod Serling United States July 1, 2017 1963 TV-PG 4 Seasons Classic & Cult TV, TV Sci-Fi & Fantasy Hosted by creator Rod Serling, this groundbrea...
5805 70155574 TV Show The Andy Griffith Show 0 Andy Griffith, Ron Howard, Don Knotts, Frances... United States July 1, 2017 1967 TV-G 8 Seasons Classic & Cult TV, TV Comedies Homespun humor and easygoing Sheriff Andy Tayl...
5529 70136140 TV Show Star Trek 0 William Shatner, Leonard Nimoy, DeForest Kelle... United States October 1, 2017 1968 TV-PG 3 Seasons Classic & Cult TV, TV Action & Adventure, TV S... Led by unflappable Capt. Kirk, the crew of the...
5599 70157402 TV Show Highway to Heaven 0 Michael Landon, Victor French United States November 1, 2016 1988 TV-PG 5 Seasons TV Dramas Under God's direction, angel Jonathan and ex-c...
369 70208520 TV Show High Risk 0 0 United States September 1, 2017 1988 TV-G 1 Season Docuseries, Reality TV From scientists to snake handlers, this series...
5807 70153408 TV Show Twin Peaks 0 Kyle MacLachlan, Michael Ontkean, Mädchen Amic... United States July 1, 2017 1990 TV-MA 2 Seasons Classic & Cult TV, Crime TV Shows, TV Dramas "Who killed Laura Palmer?" is the question on ...
3689 70202577 TV Show Ken Burns: The Civil War Ken Burns Sam Waterston, Julie Harris, Jason Robards, Mo... United States February 22, 2017 1990 TV-14 1 Season Docuseries Ken Burns's documentary depicts the action of ...
5909 80023876 TV Show Pee-wee's Playhouse 0 Paul Reubens United States December 18, 2014 1990 TV-PG 5 Seasons Classic & Cult TV, Kids' TV, TV Comedies Pee-wee Herman brings his stage show to the ma...
5801 70152640 TV Show Cheers 0 Ted Danson, Rhea Perlman, George Wendt, John R... United States July 1, 2017 1992 TV-PG 11 Seasons Classic & Cult TV, TV Comedies Sam Malone, an ex-baseball player turned bar o...

Top American Actors Casted

In [33]:
pd.Series(netflix_usa.cast.dropna().str.split(', ').sum()).value_counts().head(15)
Out[33]:
Fred Tatasciore      15
Erin Fitzgerald      14
Laura Bailey         13
Kate Higgins         13
Molly Shannon        13
Danny Trejo          12
Samuel L. Jackson    12
Adam Sandler         12
Keith David          11
Morgan Freeman       11
Seth Rogen           11
Kari Wahlgren        10
Keanu Reeves         10
Nicolas Cage         10
Janeane Garofalo     10
dtype: int64

Top Directors

In [34]:
pd.Series(netflix_usa.director.dropna().str.split(', ').sum()).value_counts().head(15)
Out[34]:
Jay Karas            14
Jay Chapman          12
Marcus Raboy         12
Martin Scorsese       8
Shannon Hartman       8
Lance Bangs           7
Ryan Polito           7
Leslie Small          6
Robert Rodriguez      6
Vlad Yudin            6
William Lau           6
Kevin Smith           5
Noah Baumbach         5
Ken Burns             5
Steven Soderbergh     5
dtype: int64

Content Contibuted By USA

In [35]:
usa_content=netflix_usa[['type','release_year']]
usa_content=usa_content.rename(columns={"release_year": "Release Year"})
american_content=usa_content.groupby(['Release Year','type']).size().reset_index(name='Total Content')
american_content=american_content[american_content['Release Year']>=2010]
fig3 = px.line(american_content, x="Release Year", y="Total Content",color='type', title='Content produced by USA over the years on Netflix',color_discrete_sequence=px.colors.sequential.Reds_r,template='plotly_dark')
fig3.show()

DURATION RELATED ANALYSIS

In [36]:
netflix_movies['duration']=netflix_movies['duration'].str.replace(' min','')
netflix_movies['duration']=netflix_movies['duration'].astype(str).astype(int)
netflix_movies['duration']
sns.set(style="darkgrid")
sns.kdeplot(data=netflix_movies['duration'], shade=True)
Out[36]:
<matplotlib.axes._subplots.AxesSubplot at 0x1f00f003b48>

Shows

Series With Most Number Of Seasons

In [37]:
features=['title','duration']
durations= netflix_shows[features]

durations['no_of_seasons']=durations['duration'].str.replace(' Season','')

durations['no_of_seasons']=durations['no_of_seasons'].str.replace('s','')
durations['no_of_seasons']=durations['no_of_seasons'].astype(str).astype(int)

t=['title','no_of_seasons']
top=durations[t]
top=top.sort_values(by='no_of_seasons', ascending=False)
top20=top[0:20]
fig= px.histogram(top20,x='title',y='no_of_seasons',title='Seasons of Shows',color='no_of_seasons',
                  color_discrete_sequence=px.colors.sequential.Reds_r,template='plotly_dark')
fig.show()

Series With Least Number Of Seasons

In [38]:
features=['title','duration']
durations= netflix_shows[features]

durations['no_of_seasons']=durations['duration'].str.replace(' Season','')

durations['no_of_seasons']=durations['no_of_seasons'].str.replace('s','')
durations['no_of_seasons']=durations['no_of_seasons'].astype(str).astype(int)

t=['title','no_of_seasons']
top=durations[t]
top=top.sort_values(by='no_of_seasons', ascending=False)
bottom=top.sort_values(by='no_of_seasons')
bottom=bottom[0:20]
bottom
Out[38]:
title no_of_seasons
2 Transformers Prime 1
26 Castle of Stars 1
28 First and Last 1
34 Archibald's Next Big Thing 1
39 The Spy 1
54 No Tomorrow 1
61 Frequency 1
63 Adam Ruins Everything 1
64 Ben 10 1
66 Christiane Amanpour: Sex & Love Around the World 1
67 The Eighties 1
135 BONDING 1
68 The Nineties 1
8 Fire Chasers 1
70 We Bare Bears 1
74 Lovesick 1
80 Mak Cun 1
83 Paul Hollywood's Big Continental Road Trip 1
84 Satu Hari 1
93 Made in Mexico 1

Movies

Overall Count

In [42]:
top_duration=pd.value_counts(netflix['duration'])
top_duration
Out[42]:
1 Season     1293
2 Seasons     301
3 Seasons     153
90 min        108
91 min        102
             ... 
182 min         1
15 min          1
3 min           1
33 min          1
190 min         1
Name: duration, Length: 198, dtype: int64

RATING RELATED ANALYSIS

Show Rating Analysis

In [43]:
rating_shows=netflix_tiles[netflix_tiles['type']=='TV Show'].dropna()
Rating_shows= rating_shows.groupby(['rating']).size().reset_index(name='counts')
fig= px.pie(Rating_shows, values='counts', names='rating', 
                  title='Distribution of Show Ratings on Netflix',
                  color_discrete_sequence=px.colors.sequential.Reds_r,template='plotly_dark')
fig.show()

Movie Ratings Analysis

In [44]:
rating_movies=netflix_tiles[netflix_tiles['type']=='Movie'].dropna()
Rating_movies= rating_movies.groupby(['rating']).size().reset_index(name='counts')
fig= px.pie(Rating_movies, values='counts', names='rating', 
                  title='Distribution of Movie Ratings on Netflix',
                  color_discrete_sequence=px.colors.sequential.Reds_r,template='plotly_dark')
fig.show()

GENRE RELATED ANALYSIS

Shows

Shows Genre Analysis

In [46]:
genres1=list(netflix_shows['listed_in'])
gen1=[]

for i in genres1:
    
    i=list(i.split(','))
    for j in i:
        gen1.append(j.replace(' ',""))
g1=Counter(gen1)
g1={k: v for k, v in sorted(g1.items(), key=lambda item: item[1], reverse= True)}
x=list(g1.keys())
y=list(g1.values())
z=[x,y]
fig = px.scatter(z,x,y,size=y,title='Show Genre on Netflix',color_discrete_sequence=px.colors.cyclical.HSV,template='plotly_dark')
fig.show()
In [47]:
def Sci_Fi(df,condition,column_name):       
    result=pd.Series(df.loc[condition][column_name].dropna().str.split(', ').sum()).value_counts()
    return result  
Sci_Fi(netflix_tiles,(netflix_tiles.type=='TV Show') & (netflix_tiles.listed_in.str.contains('Sci-Fi & Fantasy')),'country')      
Out[47]:
United States     50
Canada             5
United Kingdom     3
India              3
New Zealand        3
China              2
Australia          2
Mexico             1
Brazil             1
Taiwan             1
Belgium            1
France             1
Egypt              1
dtype: int64
In [48]:
#Anime analysis country-wise(Top most anime watching countries)#
def Anime(df,condition,column_name):       
    result=pd.Series(df.loc[condition][column_name].dropna().str.split(', ').sum()).value_counts()
    return result     
Anime(netflix_tiles,(netflix_tiles.type=='TV Show') & (netflix_tiles.listed_in.str.contains("Anime Series")),'country')
Out[48]:
Japan            103
United States      9
Canada             2
South Korea        1
dtype: int64
In [49]:
#Kids_show analysis country-wise
def Kids_show(df,condition,column_name):       
    result=pd.Series(df.loc[condition][column_name].dropna().str.split(', ').sum()).value_counts()
    return result    
Kids_show(netflix_tiles,(netflix_tiles.type=='TV Show') & (netflix_tiles.listed_in.str.contains("Kids' TV")),'country')
Out[49]:
United States     154
Canada             49
France             32
Japan              27
United Kingdom     21
South Korea        16
Australia          14
Italy               6
India               5
Mexico              4
New Zealand         4
China               4
Malaysia            4
Russia              4
Germany             4
Denmark             3
Argentina           3
Spain               3
Ireland             2
Brazil              2
Netherlands         2
Singapore           2
Cyprus              1
Thailand            1
Austria             1
Finland             1
Sweden              1
Indonesia           1
dtype: int64
In [50]:
#Romance genre analysis country-wise
def Romance(df,condition,column_name):       
    result=pd.Series(df.loc[condition][column_name].dropna().str.split(', ').sum()).value_counts()
    return result
Romance(netflix_tiles,(netflix_tiles.type=='TV Show') & (netflix_tiles.listed_in.str.contains("Romantic TV Shows")),'country')
Out[50]:
South Korea       48
Taiwan            47
United States     27
China             18
Japan             17
United Kingdom     9
Spain              8
Thailand           8
India              6
Turkey             5
Mexico             5
Pakistan           4
Singapore          3
Australia          2
Egypt              2
France             2
Colombia           2
Canada             2
Norway             1
Azerbaijan         1
Indonesia          1
Lebanon            1
Malaysia           1
Russia             1
South Africa       1
Hong Kong          1
Argentina          1
Sweden             1
Brazil             1
dtype: int64
In [51]:
#Comedy genre analysis country-wise
def Comedy(df,condition,column_name):       
    result=pd.Series(df.loc[condition][column_name].dropna().str.split(', ').sum()).value_counts()
    return result
Comedy(netflix_tiles,(netflix_tiles.type=='TV Show') & (netflix_tiles.listed_in.str.contains("TV Comedies")),'country')
Out[51]:
United States     190
United Kingdom     38
Taiwan             38
Canada             27
France             16
India              15
Australia          12
Japan               9
China               9
South Korea         7
Brazil              6
Spain               5
Norway              4
Thailand            3
Mexico              3
Egypt               2
Singapore           2
Denmark             2
Turkey              2
Ireland             2
Germany             2
Sweden              2
Italy               2
Malaysia            2
West Germany        1
Switzerland         1
Ukraine             1
Argentina           1
Finland             1
Hong Kong           1
Cyprus              1
South Africa        1
Netherlands         1
Russia              1
Austria             1
Israel              1
dtype: int64
In [52]:
#International_shows genre analysis country-wise
def International_shows(df,condition,column_name):       
    result=pd.Series(df.loc[condition][column_name].dropna().str.split(', ').sum()).value_counts()
    return result
International_shows(netflix_tiles,(netflix_tiles.type=='TV Show') & (netflix_tiles.listed_in.str.contains("International TV Shows")),'country')
Out[52]:
Japan                   110
United Kingdom          104
South Korea              96
Taiwan                   65
United States            56
India                    47
Spain                    40
France                   34
Mexico                   31
China                    30
Australia                26
Turkey                   25
Colombia                 21
Canada                   20
Thailand                 17
Germany                  17
Brazil                   14
Singapore                11
Argentina                10
Egypt                     9
Russia                    9
Israel                    8
Lebanon                   7
Belgium                   7
Norway                    7
Sweden                    7
Italy                     6
Denmark                   6
Hong Kong                 4
Poland                    4
Pakistan                  4
Chile                     4
Malaysia                  3
Ireland                   3
Netherlands               3
South Africa              3
Czech Republic            2
Greece                    2
Ukraine                   2
New Zealand               2
Finland                   2
Mauritius                 1
West Germany              1
Croatia                   1
Azerbaijan                1
Cuba                      1
Philippines               1
Syria                     1
Switzerland               1
Saudi Arabia              1
Indonesia                 1
Jordan                    1
Kuwait                    1
United Arab Emirates      1
Iceland                   1
dtype: int64

Movies

Movie Genre Analysis

In [53]:
genres=list(netflix_movies['listed_in'])
gen=[]

for i in genres:
    i=list(i.split(','))
    for j in i:
        gen.append(j.replace(' ',""))
g=Counter(gen)
g={k: v for k, v in sorted(g.items(), key=lambda item: item[1], reverse= True)}
x=list(g.keys())
y=list(g.values())
z=[x,y]
fig= px.scatter(z,x,y,size=y,title='Movie Genre on Netflix',color_discrete_sequence=px.colors.cyclical.HSV,template='plotly_dark')
fig.show()
In [54]:
def Stand_up(df,condition,column_name):       
    result=pd.Series(df.loc[condition][column_name].dropna().str.split(', ').sum()).value_counts()
    return result
Stand_up(netflix_tiles,(netflix_tiles.type=='Movie') & (netflix_tiles.listed_in.str.contains("Stand-Up Comedy")),'country')
Out[54]:
United States     183
United Kingdom     17
Mexico             16
Argentina           7
Brazil              6
Italy               4
France              4
Chile               3
Colombia            3
Canada              2
Germany             2
South Korea         2
Netherlands         1
Australia           1
Singapore           1
India               1
dtype: int64
In [55]:
def Action_and_adventure_movies(df,condition,column_name):       
    result=pd.Series(df.loc[condition][column_name].dropna().str.split(', ').sum()).value_counts()
    return result
Action_and_adventure_movies(netflix_tiles,(netflix_tiles.type=='Movie') & (netflix_tiles.listed_in.str.contains("Action & Adventure")),'country')
Out[55]:
United States           218
India                   126
Hong Kong                64
United Kingdom           52
China                    47
Japan                    36
Canada                   26
Germany                  18
France                   16
South Korea              15
Australia                 9
South Africa              9
Belgium                   9
Egypt                     7
Thailand                  7
Mexico                    5
Philippines               5
Indonesia                 5
Singapore                 5
Spain                     5
Turkey                    5
Brazil                    3
Czech Republic            3
Malaysia                  3
Bulgaria                  3
United Arab Emirates      3
New Zealand               3
Denmark                   3
Argentina                 3
Russia                    2
Nigeria                   2
Taiwan                    2
Vietnam                   2
Sweden                    2
Norway                    2
Hungary                   2
Pakistan                  2
Malta                     1
Israel                    1
Iceland                   1
Poland                    1
Italy                     1
Paraguay                  1
Luxembourg                1
Netherlands               1
Ireland                   1
Switzerland               1
Morocco                   1
Cambodia                  1
Finland                   1
Soviet Union              1
Serbia                    1
Nepal                     1
Chile                     1
dtype: int64
In [56]:
def Thriller_movies(df,condition,column_name):       
    result=pd.Series(df.loc[condition][column_name].dropna().str.split(', ').sum()).value_counts()
    return result
Thriller_movies(netflix_tiles,(netflix_tiles.type=='Movie') & (netflix_tiles.listed_in.str.contains("Thriller")),'country')
Out[56]:
United States           188
India                    70
United Kingdom           40
Canada                   29
Spain                    27
France                   21
Germany                  15
South Korea              11
Australia                 8
Belgium                   7
Italy                     6
Nigeria                   6
Argentina                 5
Denmark                   5
Turkey                    4
United Arab Emirates      4
China                     4
Poland                    3
Sweden                    3
Norway                    3
Bulgaria                  3
Singapore                 3
Mexico                    2
Hong Kong                 2
Philippines               2
Thailand                  2
Jordan                    2
Israel                    2
Romania                   2
Qatar                     2
Egypt                     2
Brazil                    2
Japan                     2
Chile                     1
West Germany              1
Dominican Republic        1
Switzerland               1
Czech Republic            1
Netherlands               1
South Africa              1
Iceland                   1
Taiwan                    1
Luxembourg                1
Iran                      1
Hungary                   1
Vietnam                   1
dtype: int64
In [57]:
def Horror_movies(df,condition,column_name):       
    result=pd.Series(df.loc[condition][column_name].dropna().str.split(', ').sum()).value_counts()
    return result
Horror_movies(netflix_tiles,(netflix_tiles.type=='Movie') & (netflix_tiles.listed_in.str.contains("Horror")),'country')
Out[57]:
United States           123
India                    30
Canada                   20
United Kingdom           19
Thailand                 15
Indonesia                10
Spain                     9
France                    8
Turkey                    6
Mexico                    4
Malaysia                  4
Belgium                   4
Japan                     3
South Korea               3
Singapore                 3
Philippines               3
Australia                 3
Argentina                 3
Chile                     2
Ireland                   2
Germany                   2
Peru                      2
Egypt                     1
Vietnam                   1
Iceland                   1
South Africa              1
West Germany              1
Dominican Republic        1
Bulgaria                  1
Nigeria                   1
China                     1
Slovenia                  1
Serbia                    1
Jordan                    1
Pakistan                  1
Italy                     1
Poland                    1
Iran                      1
United Arab Emirates      1
Taiwan                    1
Israel                    1
Qatar                     1
dtype: int64
In [58]:
def Romantic_movies(df,condition,column_name):       
    result=pd.Series(df.loc[condition][column_name].dropna().str.split(', ').sum()).value_counts()
    return result
Romantic_movies(netflix_tiles,(netflix_tiles.type=='Movie') & (netflix_tiles.listed_in.str.contains("Romantic")),'country')
Out[58]:
United States     124
India              90
Philippines        20
United Kingdom     20
France             17
Turkey             16
Canada             16
Indonesia          13
Hong Kong          10
Spain               9
China               9
Thailand            9
Nigeria             8
Egypt               5
Germany             5
Ireland             4
Pakistan            4
Japan               4
Mexico              4
Netherlands         3
Belgium             3
Argentina           3
Italy               2
Poland              2
Taiwan              2
Colombia            2
Australia           2
South Africa        2
Denmark             1
Peru                1
Portugal            1
Sweden              1
Romania             1
Singapore           1
Saudi Arabia        1
Malaysia            1
Hungary             1
Soviet Union        1
South Korea         1
Liechtenstein       1
Greece              1
Norway              1
Brazil              1
dtype: int64

Overall Genre Analysis With Respect To Countries

In [59]:
features=['listed_in','country']
a= netflix_tiles[features]
shows_genre= ", ".join(netflix_tiles['listed_in'].dropna()).split(", ")
a['listed_in']=pd.Series(shows_genre)
shows_countries = ", ".join(netflix_tiles['country'].dropna()).split(", ")
a['country']=pd.Series(shows_countries)
b=a.head(150)
dfs = b.groupby('listed_in')['country'].value_counts().unstack().fillna(0).T
fig=px.imshow(dfs,color_continuous_scale=px.colors.sequential.Reds,aspect='auto',title='Distribution of Genres With Respect To Countries',template='plotly_dark',width=1000,height=1000)
fig.show()

SENTIMENTS ANALYSIS

In [60]:
sentiments=netflix[['release_year','description']]
for index,row in sentiments.iterrows():
    z=row['description']
    testimonial=TextBlob(z)
    p=testimonial.sentiment.polarity
    if p==0:
        sent='Neutral'
    elif p>0:
        sent='Positive'
    else:
        sent='Negative'
    sentiments.loc[[index,2],'Sentiment']=sent


sentiments=sentiments.groupby(['release_year','Sentiment']).size().reset_index(name='Total Content')

sentiments=sentiments[sentiments['release_year']>=2010]
fig = px.bar(sentiments, x="release_year", y="Total Content", color="Sentiment", title="Sentiment of content on Netflix",color_discrete_sequence=px.colors.sequential.Reds_r,template='plotly_dark')
fig.show()

THE RECOMMENDATION SYSTEM

Based On Plot

In [61]:
tfidf = TfidfVectorizer(stop_words='english')

netflix['description'] = netflix['description'].fillna('')

tfidf_matrix = tfidf.fit_transform(netflix['description'])

cosine_sim = linear_kernel(tfidf_matrix, tfidf_matrix)

indices = pd.Series(netflix.index, index=netflix['title']).drop_duplicates()

def get_recommendations(title, cosine_sim=cosine_sim):
    idx = indices[title]

    sim_scores = list(enumerate(cosine_sim[idx]))

    sim_scores = sorted(sim_scores, key=lambda x: x[1], reverse=True)

    sim_scores = sim_scores[1:11]

    movie_indices = [i[0] for i in sim_scores]

    return netflix['title'].iloc[movie_indices]
In [62]:
recommendation=(input("Enter a movie/show:"))
Enter a movie/show:Dark
In [63]:
get_recommendations(recommendation)
Out[63]:
3716                Altered Carbon
150                         Maniac
3764                     Candyflip
4140    Black Mirror: Bandersnatch
1820                Kia and Cosmos
868                   Jagga Jasoos
1852                     Love Rain
521                       Shirkers
2523                         ANIMA
3343                       Skyline
Name: title, dtype: object

Based On Plot, Cast, Director, Title, Listed_in

In [64]:
filledna=netflix_tiles.fillna('')
def data(x):
        return str.lower(x.replace(" ", ""))
features=['title','director','cast','listed_in','description']
filledna=filledna[features]
for feature in features:
    filledna[feature] = filledna[feature].apply(data)

def recommendation_aspects(x):
    return x['title']+ ' ' + x['director'] + ' ' + x['cast'] + ' ' +x['listed_in']+' '+ x['description']
filledna['aspects'] = filledna.apply(recommendation_aspects, axis=1)
count = CountVectorizer(stop_words='english')
count_matrix = count.fit_transform(filledna['aspects'])

cosine_sim2 = cosine_similarity(count_matrix, count_matrix)
filledna=filledna.reset_index()
indices = pd.Series(filledna.index, index=filledna['title'])
def get_recommendations_new(title, cosine_sim=cosine_sim):
    title=title.replace(' ','').lower()
    idx = indices[title]
    
    sim_scores = list(enumerate(cosine_sim[idx]))

    sim_scores = sorted(sim_scores, key=lambda x: x[1], reverse=True)

    sim_scores = sim_scores[1:21]

    movie_indices = [i[0] for i in sim_scores]

    return netflix_tiles['title'].iloc[movie_indices]
In [65]:
recommendation=(input("Enter a movie/show:"))
Enter a movie/show:Dark
In [66]:
get_recommendations_new(recommendation, cosine_sim2)
Out[66]:
5929                                       Wanted
4551                                     Sintonia
4847                                      Persona
744                                   Black Heart
2640                                      Unit 42
3156                            The Truth Seekers
522                         Terrorism Close Calls
1604                               Killer Ratings
4618                     Inside the Criminal Mind
580                                      The Liar
1317                                      Warrior
1570                                   The Writer
2078                                Day and Night
2199                                Khotey Sikkey
2743                                    Mind Game
3789                                       Powder
4964    Have You Ever Fallen in Love, Miss Jiang?
527                                   Brotherhood
771                                    Blood Pact
1303                                   The Method
Name: title, dtype: object